package com.ruoyi.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.mapper.LogMapper;
import com.ruoyi.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    LogMapper logMapper;

    @Override
    public int insertHouseRpPriceLog(String hotelId, String houseId, String rpId, Long userId, String logDetails) {
        Map map = new HashMap();
        map.put("hotelId", hotelId);
        map.put("houseId", houseId);
        map.put("rpId", rpId);
        map.put("userId", userId);
        map.put("logDetails", logDetails);
        return logMapper.insertHouseRpPriceLog(map);
    }

    @Override
    public int insertOrderLog(String orderCode, String logDescribe, int type) {
        Long userId = null;
        if (type == 2) {
            userId = SecurityUtils.getUserId();
        }
        return logMapper.insertOrderLog(orderCode, userId, logDescribe);
    }

    @Override
    public List<Map> getOrderLogByOrderCode(String orderCode) {
        return logMapper.getOrderLogByOrderCode(orderCode);
    }

    @Override
    public List<Map> getHouseLog(Map map) {
        return logMapper.getHouseLog(map);
    }
}
